package com.js.foodordersystem.util;

import java.io.File;
import java.io.FileOutputStream;

public class UploadFileUtil {

    //文件上传工具类服务方法
    public static boolean uploadFile(byte[] file,String filePath,String fileName)  {
        File targetFile = new File(filePath);
        if(!targetFile.exists()){
            targetFile.mkdirs();
        }
        try {
            FileOutputStream out = new FileOutputStream(filePath + fileName);
            out.write(file);
            out.flush();
            out.close();
            return true;
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }


}
